package com.ibks.mini5jo.login;

import java.util.Map;

import com.ibks.iframe.CommonPageUnit;
import com.ibks.iframe.ServiceConst;
import com.ibks.iframe.core.data.ServiceContext;
import com.ibks.iframe.pageunit.PageUnitException;
import com.ibks.iframe.service.ServiceHelper;

public class LoginManagePU extends CommonPageUnit {

	@SuppressWarnings("unchecked")
	public String execute(ServiceContext context) throws PageUnitException {
		String pageOut = ServiceConst.FAILVIEW;
		Map mp = context.getRequestParameterMap();
		String id = mp.get("EMP_NO").toString();
		String pass = mp.get("PSWD").toString();
		if (id == null) {
			id = "";
		}
		if (pass == null) {
			pass = "";
		}
		
		context.getSession().clearAllData();
		
		if (id.length() > 0 && pass.length() > 0) {
			ServiceHelper.invoke("LoginManageSU.doLogin", context);
			if ( !context.isError() ){
				pageOut = ServiceConst.INITVIEW;
			}
		}
		
		setMessage(context, pageOut);
		return context.getReturnFlag();
	}

}
